package com.itheima.app;

import com.itheima.dao.OrderDao;
import com.itheima.dao.StudentDao;
import com.itheima.dao.UserDao;
import com.itheima.service.StudentService;
import com.itheima.service.TeacherService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class IOCStuApp {
    public static void main(String[] args) {
        ApplicationContext app = new ClassPathXmlApplicationContext("application-cof.xml");
//        StudentDao studentDao = (StudentDao) app.getBean("studentDao");
//        studentDao.save();
//
        OrderDao orderDao = (OrderDao) app.getBean("orderDao");
        orderDao.save();
        System.out.println("-------------------------------");
        StudentService studentService = (StudentService) app.getBean("studentService");
        studentService.save();
        System.out.println("------------------------------");
        TeacherService teacherService = (TeacherService) app.getBean("teacherService");
        teacherService.save();
        System.out.println("-------------------------------");
        UserDao userDao = (UserDao) app.getBean("userDao");
        userDao.save();
    }
}
